home *** CD-ROM | disk | FTP | other *** search
-
- -- We need to be able to place some traps, but not have it cost anything.
- function TrapPlace( textname , place, face)
- G.edit( true )
- G.AttemptTrapDrop(textname, place, face);
- G.edit( false )
- end
-
- -- Cinematic Code:
- function StartCinematic()
- -- Put up the Bars, Disable actions
- ActivateCinemaBars();
-
- if( Camera ~= nil ) then
- Camera.EnterCinemaMode()
- cinemaCameraStartPos = Camera.GetPosition()
- cinemaCameraStartDir = Camera.GetDirection() + cinemaCameraStartPos
- end
-
- -- Disable / Hide the cursor
- G.SetCursorActive( false );
-
- if( Cursor ~= nil ) then
- Cursor.SetVelocity( Vector3(0,0,0) )
- Cursor.SetPosition( Vector3(0,0,0) )
-
- -- Have the cursor stop dropping any trap
- Cursor.ExitTrapMode();
- end
-
- -- PAUSE INVADERS
- end
-
- function EndCinematic()
- -- Remove bars, Enable actions
- DeactivateCinemaBars()
-
- if( Camera ~= nil ) then
- Camera.RegularMove( cinemaCameraStartPos, cinemaCameraStartDir, 0.5 )
- end
- -- Camera.ExitCinemaMode()
- G.SetCursorActive( true );
-
- -- RESUME INVADERS
- end
-
- ----------------------------------------------------------------
- -- Bars Code
- ----------------------------------------------------------------
-
-
- CinemaBarsProgress = 0.0 -- From 0 to 1 (offscreen / final pos)
- CinemaBarsMovement = 0.0 -- Movement direction (Down / up)
-
- function ActivateCinemaBars()
- if( CinemaBars == nil or not( CinemaBars.IsValid()) ) then
- G.Create( "MenuData/CinemaBarsCog.xml" );
- end
-
- CinemaBarsProgress = 0.0
- CinemaBarsMovement = 1.0
-
- if( HUD ~= nil ) then
- HUD.CloseWindow( "CombinedHUDWindow" );
- end
- end
-
- function DeactivateCinemaBars()
- CinemaBarsMovement = -1.0
- if( HUD ~= nil ) then
- HUD.OpenWindow( "CombinedHUDWindow" );
- end
-
- end
-
- function KillCinemaBars()
- if( CinemaBars ~= nil and CinemaBars.IsValid() ) then
- CinemaBars.Destroy();
- if( HUD ~= nil ) then
- -- HUD.OpenWindow( "CombinedHUDWindow" );
- end
- end
- end
-
- function UpdateCinemaBars()
-
- if( CinemaBars ~= nil and CinemaBars.IsValid() ) then
- -- Bars should start off screen and move (fade?) on
- CinemaBarsProgress = CinemaBarsProgress + CinemaBarsMovement * GameTimeDiff;
-
- if( CinemaBarsProgress < 0.0 ) then -- Off screen
- CinemaBarsProgress = 0.0
- KillCinemaBars()
- else
-
- if( CinemaBarsProgress > 1.0 ) then
- CinemaBarsProgress = 1.0
- end
-
- curPos = CinemaBarsProgress * 0.2
- CinemaBars.SetGuiPosition( "TopCinemaBar", Vector3(0, 1.0 - curPos, 0) );
- CinemaBars.SetGuiPosition( "BottomCinemaBar", Vector3(0, -1.0 + curPos, 0) );
-
- barFadeColor = Color(1,1,1, CinemaBarsProgress );
- CinemaBars.SetColor( "TopCinemaBar", barFadeColor );
- CinemaBars.SetColor( "BottomCinemaBar", barFadeColor );
-
- end
- end
-
- end
-
- -- Always update Function:
- GMain[ "UpdateCinemaBars" ] = UpdateCinemaBars;
-
- -------------------------------------------------------------------------------
- -- Other Cinema Functions
- -------------------------------------------------------------------------------
-
-